package com.lin.subject.infra.basic.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lin.subject.infra.basic.entity.SubjectInfo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author jeremylin
* @description 针对表【subject_info(题目信息表)】的数据库操作Mapper
* @createDate 2024-10-21 11:12:25
* @Entity com.lin.subject.infra.basic.basic.SubjectInfo
*/
public interface SubjectInfoDao extends BaseMapper<SubjectInfo> {

    /**
     * 查询对应题目的总数
     * @param subjectInfo
     * @param categoryId
     * @param labelId
     * @return
     */
    int countByCondition(@Param("subjectInfo") SubjectInfo subjectInfo,
                         @Param("categoryId") Long categoryId,
                         @Param("labelId") Long labelId);

    /**
     * 查询对应题目的总数
     * @param subjectInfo
     * @param categoryId
     * @return
     */
    int countByCondition2(@Param("subjectInfo") SubjectInfo subjectInfo,
                         @Param("categoryId") Long categoryId);
    /**
     * 题目分页查询
     * @param subjectInfo
     * @param categoryId
     * @param labelId
     * @param start
     * @param pageSize
     * @return
     */
    List<SubjectInfo> queryPage(@Param("subjectInfo") SubjectInfo subjectInfo,
                                @Param("categoryId") Long categoryId,
                                @Param("labelId")Long labelId,
                                @Param("start") int start,
                                @Param("pageSize") Integer pageSize);

    /**
     * 题目分页查询
     * @param subjectInfo
     * @param categoryId
     * @param start
     * @param pageSize
     * @return
     */
    List<SubjectInfo> queryPage2(@Param("subjectInfo") SubjectInfo subjectInfo,
                                @Param("categoryId") Long categoryId,
                                @Param("start") int start,
                                @Param("pageSize") Integer pageSize);

    List<SubjectInfo> getContributeCount();

    /**
     * 查询游标
     * @param subjectId
     * @param categoryId
     * @param labelId
     * @param cursor
     * @return
     */
    Long querySubjectIdCursor(@Param("subjectId") Long subjectId,
                              @Param("categoryId") Long categoryId,
                              @Param("labelId") Long labelId,
                              @Param("cursor") int cursor);
}





